package heapTree.nodes;

/**
 * Class Node implements Comparable
 * 
 * @author Ganesh Kumar
 */
public class Node<T extends Comparable<T>> implements Comparable<Node<T>>{

	private double value;
	private int timeStep; // also the level of the tree 
	private long nodeId;

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}


	public int getTimeStep() {
		return timeStep;
	}


	public void setTimeStep(int timeStep) {
		this.timeStep = timeStep;
	}
	

	public long getNodeId() {
		return nodeId;
	}

	public void setNodeId(long nodeId) {
		this.nodeId = nodeId;
	}
	
	@Override
	public int compareTo(Node<T> o) {
		if(this.nodeId==o.getNodeId())
			return 0;
		else if(this.nodeId<o.nodeId)
			return -1;
		else return 1;
	}
	
	public boolean equalValues(Object obj) {
		if(this == null && obj!=null)
			return false;
		if(this != null && obj==null)
			return false;
		if (this == obj)
			return true;
		if (getClass() != obj.getClass())
			return false;
		final Node other = (Node) obj;

		if (Double.doubleToLongBits(value) != Double
				.doubleToLongBits(other.value))
			return false;
		return true;
	}
}